<template>
  <div>
    <van-nav-bar title="出租列表">
      <template #left>
        <van-icon
          name="arrow-left"
          size="18"
          color="white"
          @click="$router.go(-1)"
        />
      </template>
    </van-nav-bar>

    <RenderLi v-for="(item,index) in renderList" :key="index" :item="item" />

    <van-empty  v-if="flag" >
   <div class="box"><span>您还没有房源</span><router-link to="/publishHouse">，去发布房源吧</router-link></div>
    </van-empty>
  </div>
</template>

<script>
import RenderLi from '@/components/RenderLi.vue'
import {getHireList} from '@/api/house'
export default {
  name: 'HireList',
  props: {},
  components:{
    RenderLi
  },
  data(){
    return{
      renderList:[],
      flag:false
    }
  },
 async created(){
  const {data:{body}}= await getHireList()
  this.renderList=body
  if(!this.renderList){
    this.flag=true
  }
  }
}
</script>

<style scoped lang="less">
.van-nav-bar {
  background-color: #23d881 !important;
}
.van-nav-bar .van-icon {
  color: white !important;
}
.box{
  font-size: 14px;
  color: #ccc;
  a{
    color: #23d881;
  }
}
</style>
